{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a href=\"https://colab.research.google.com/github/enzoampil/fastquant/blob/master/examples/stock_data_cache.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# uncomment to install in colab\n",
    "# !pip install -e git+https://github.com/enzoampil/fastquant.git@master#egg=fastquant"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from fastquant import get_pse_data_cache, get_stock_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>Symbol</th>\n",
       "      <th colspan=\"5\" halign=\"left\">2GO</th>\n",
       "      <th colspan=\"5\" halign=\"left\">AAA</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"5\" halign=\"left\">WPI</th>\n",
       "      <th colspan=\"5\" halign=\"left\">ZHI</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>value</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>value</th>\n",
       "      <th>...</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>value</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>value</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-06-04</th>\n",
       "      <td>9.55</td>\n",
       "      <td>9.55</td>\n",
       "      <td>9.25</td>\n",
       "      <td>9.50</td>\n",
       "      <td>859225.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.390</td>\n",
       "      <td>0.410</td>\n",
       "      <td>0.390</td>\n",
       "      <td>0.405</td>\n",
       "      <td>139850.0</td>\n",
       "      <td>0.150</td>\n",
       "      <td>0.150</td>\n",
       "      <td>0.147</td>\n",
       "      <td>0.147</td>\n",
       "      <td>192870.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-06-05</th>\n",
       "      <td>9.55</td>\n",
       "      <td>9.78</td>\n",
       "      <td>9.50</td>\n",
       "      <td>9.64</td>\n",
       "      <td>626673.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.395</td>\n",
       "      <td>0.395</td>\n",
       "      <td>0.395</td>\n",
       "      <td>0.395</td>\n",
       "      <td>15800.0</td>\n",
       "      <td>0.149</td>\n",
       "      <td>0.149</td>\n",
       "      <td>0.147</td>\n",
       "      <td>0.147</td>\n",
       "      <td>53180.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-06-08</th>\n",
       "      <td>9.65</td>\n",
       "      <td>9.65</td>\n",
       "      <td>9.40</td>\n",
       "      <td>9.51</td>\n",
       "      <td>1418976.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.410</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.405</td>\n",
       "      <td>148750.0</td>\n",
       "      <td>0.145</td>\n",
       "      <td>0.146</td>\n",
       "      <td>0.145</td>\n",
       "      <td>0.145</td>\n",
       "      <td>37740.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-06-09</th>\n",
       "      <td>9.55</td>\n",
       "      <td>9.80</td>\n",
       "      <td>9.55</td>\n",
       "      <td>9.80</td>\n",
       "      <td>1520175.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.415</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.415</td>\n",
       "      <td>143350.0</td>\n",
       "      <td>0.145</td>\n",
       "      <td>0.148</td>\n",
       "      <td>0.142</td>\n",
       "      <td>0.147</td>\n",
       "      <td>84080.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-06-10</th>\n",
       "      <td>10.30</td>\n",
       "      <td>12.20</td>\n",
       "      <td>10.00</td>\n",
       "      <td>11.50</td>\n",
       "      <td>27402032.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.415</td>\n",
       "      <td>0.415</td>\n",
       "      <td>0.400</td>\n",
       "      <td>0.410</td>\n",
       "      <td>280800.0</td>\n",
       "      <td>0.151</td>\n",
       "      <td>0.152</td>\n",
       "      <td>0.150</td>\n",
       "      <td>0.150</td>\n",
       "      <td>36330.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 1260 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Symbol        2GO                                   AAA                       \\\n",
       "             open   high    low  close       value open high low close value   \n",
       "dt                                                                             \n",
       "2020-06-04   9.55   9.55   9.25   9.50    859225.0  NaN  NaN NaN   NaN   NaN   \n",
       "2020-06-05   9.55   9.78   9.50   9.64    626673.0  NaN  NaN NaN   NaN   NaN   \n",
       "2020-06-08   9.65   9.65   9.40   9.51   1418976.0  NaN  NaN NaN   NaN   NaN   \n",
       "2020-06-09   9.55   9.80   9.55   9.80   1520175.0  NaN  NaN NaN   NaN   NaN   \n",
       "2020-06-10  10.30  12.20  10.00  11.50  27402032.0  NaN  NaN NaN   NaN   NaN   \n",
       "\n",
       "Symbol      ...    WPI                                   ZHI                \\\n",
       "            ...   open   high    low  close     value   open   high    low   \n",
       "dt          ...                                                              \n",
       "2020-06-04  ...  0.390  0.410  0.390  0.405  139850.0  0.150  0.150  0.147   \n",
       "2020-06-05  ...  0.395  0.395  0.395  0.395   15800.0  0.149  0.149  0.147   \n",
       "2020-06-08  ...  0.400  0.410  0.400  0.405  148750.0  0.145  0.146  0.145   \n",
       "2020-06-09  ...  0.400  0.415  0.400  0.415  143350.0  0.145  0.148  0.142   \n",
       "2020-06-10  ...  0.415  0.415  0.400  0.410  280800.0  0.151  0.152  0.150   \n",
       "\n",
       "Symbol                       \n",
       "            close     value  \n",
       "dt                           \n",
       "2020-06-04  0.147  192870.0  \n",
       "2020-06-05  0.147   53180.0  \n",
       "2020-06-08  0.145   37740.0  \n",
       "2020-06-09  0.147   84080.0  \n",
       "2020-06-10  0.150   36330.0  \n",
       "\n",
       "[5 rows x 1260 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = get_pse_data_cache()\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "phisix_symbol = 'JFC'\n",
    "yahoo_symbol = \"GOOGL\"\n",
    "start_date = '2020-4-1'\n",
    "end_date = '2020-4-14'\n",
    "format = \"oc\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-04-06</th>\n",
       "      <td>104.6</td>\n",
       "      <td>106.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-07</th>\n",
       "      <td>110.2</td>\n",
       "      <td>110.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-08</th>\n",
       "      <td>111.0</td>\n",
       "      <td>120.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-13</th>\n",
       "      <td>121.0</td>\n",
       "      <td>135.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-14</th>\n",
       "      <td>139.9</td>\n",
       "      <td>146.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open  close\n",
       "dt                      \n",
       "2020-04-06  104.6  106.0\n",
       "2020-04-07  110.2  110.5\n",
       "2020-04-08  111.0  120.0\n",
       "2020-04-13  121.0  135.0\n",
       "2020-04-14  139.9  146.5"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#query within cache\n",
    "df = get_stock_data(phisix_symbol, \n",
    "                    start_date, \n",
    "                    end_date, \n",
    "                    source=\"phisix\", \n",
    "                    format=format\n",
    "                   )\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-04-06</th>\n",
       "      <td>106.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-07</th>\n",
       "      <td>110.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-08</th>\n",
       "      <td>120.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-13</th>\n",
       "      <td>135.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-14</th>\n",
       "      <td>146.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            close\n",
       "dt               \n",
       "2020-04-06  106.0\n",
       "2020-04-07  110.5\n",
       "2020-04-08  120.0\n",
       "2020-04-13  135.0\n",
       "2020-04-14  146.5"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#query within cache\n",
    "df = get_stock_data(phisix_symbol, \n",
    "                    start_date, \n",
    "                    end_date, \n",
    "                    source=\"phisix\", \n",
    "                    #format=format\n",
    "                   )\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[*********************100%***********************]  1 of 1 completed\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-04-06</th>\n",
       "      <td>1133.000000</td>\n",
       "      <td>1183.189941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-07</th>\n",
       "      <td>1217.010010</td>\n",
       "      <td>1182.560059</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-08</th>\n",
       "      <td>1203.099976</td>\n",
       "      <td>1207.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-09</th>\n",
       "      <td>1218.180054</td>\n",
       "      <td>1206.569946</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-13</th>\n",
       "      <td>1201.500000</td>\n",
       "      <td>1210.410034</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   open        close\n",
       "dt                                  \n",
       "2020-04-06  1133.000000  1183.189941\n",
       "2020-04-07  1217.010010  1182.560059\n",
       "2020-04-08  1203.099976  1207.000000\n",
       "2020-04-09  1218.180054  1206.569946\n",
       "2020-04-13  1201.500000  1210.410034"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#query within cache\n",
    "df = get_stock_data(yahoo_symbol, \n",
    "                    start_date, \n",
    "                    end_date, \n",
    "                    source=\"yahoo\", \n",
    "                    format=format\n",
    "                   )\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-04-08</th>\n",
       "      <td>111.0</td>\n",
       "      <td>120.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-13</th>\n",
       "      <td>121.0</td>\n",
       "      <td>135.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-14</th>\n",
       "      <td>139.9</td>\n",
       "      <td>146.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-15</th>\n",
       "      <td>150.0</td>\n",
       "      <td>148.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-16</th>\n",
       "      <td>147.0</td>\n",
       "      <td>141.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open  close\n",
       "dt                      \n",
       "2020-04-08  111.0  120.0\n",
       "2020-04-13  121.0  135.0\n",
       "2020-04-14  139.9  146.5\n",
       "2020-04-15  150.0  148.6\n",
       "2020-04-16  147.0  141.5"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#extend cache\n",
    "end_date = \"2020-04-16\"\n",
    "\n",
    "df = get_stock_data(phisix_symbol, \n",
    "                    start_date, \n",
    "                    end_date, \n",
    "                    source=\"phisix\", \n",
    "                    format=format\n",
    "                   )\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-04-08</th>\n",
       "      <td>120.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-13</th>\n",
       "      <td>135.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-14</th>\n",
       "      <td>146.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-15</th>\n",
       "      <td>148.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-16</th>\n",
       "      <td>141.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            close\n",
       "dt               \n",
       "2020-04-08  120.0\n",
       "2020-04-13  135.0\n",
       "2020-04-14  146.5\n",
       "2020-04-15  148.6\n",
       "2020-04-16  141.5"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#extend cache\n",
    "end_date = \"2020-04-16\"\n",
    "\n",
    "df = get_stock_data(phisix_symbol, \n",
    "                    start_date, \n",
    "                    end_date, \n",
    "                    source=\"phisix\", \n",
    "                    #format=format\n",
    "                   )\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[*********************100%***********************]  1 of 1 completed\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dt</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-04-08</th>\n",
       "      <td>1203.099976</td>\n",
       "      <td>1207.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-09</th>\n",
       "      <td>1218.180054</td>\n",
       "      <td>1206.569946</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-13</th>\n",
       "      <td>1201.500000</td>\n",
       "      <td>1210.410034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-14</th>\n",
       "      <td>1239.969971</td>\n",
       "      <td>1265.229980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-04-15</th>\n",
       "      <td>1246.510010</td>\n",
       "      <td>1257.300049</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   open        close\n",
       "dt                                  \n",
       "2020-04-08  1203.099976  1207.000000\n",
       "2020-04-09  1218.180054  1206.569946\n",
       "2020-04-13  1201.500000  1210.410034\n",
       "2020-04-14  1239.969971  1265.229980\n",
       "2020-04-15  1246.510010  1257.300049"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#extend cache\n",
    "df = get_stock_data(yahoo_symbol, \n",
    "                    start_date, \n",
    "                    end_date, \n",
    "                    source=\"yahoo\", \n",
    "                    format=format\n",
    "                   )\n",
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
